/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 涛
 * Date: 2023-09-21
 * Time: 18:47
 */
class Person implements Cloneable{
    private String name;
    private String gender;
    int age;
    public Person clone() throws CloneNotSupportedException{
        return (Person)super.clone();
    }
}

public class Test2  {
    //获取一个数组任意位置的方法
    public static int getElement(int[] array, int index) {
        //null异常
        if(null == array) {
            throw new NullPointerException("传递数组为null");
        }
        //数组下表越界异常
        if(index < 0 || index >array.length) {
            throw new ArrayIndexOutOfBoundsException("数组下标越界");
        }
        return array[index];
    }
    public static void main(String[] args) {
        int[] array1 = new int[10];
        getElement(array1, 2);
    }


    public static void main1(String[] args) throws CloneNotSupportedException{
        Person person = new Person();
        person.clone();
    }
}
